load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")

package(default_visibility = ["//visibility:public"])

proto_library(
    name = "common_proto",
    srcs = [
        "opentelemetry/proto/common/v1/common.proto",
    ],
)

cc_proto_library(
    name = "common_proto_cc",
    deps = [":common_proto"],
)

py_proto_library(
    name = "common_proto_py",
    deps = [":common_proto"],
)

go_proto_library(
    name = "common_proto_go",
    importpath = "go.opentelemetry.io/proto/otlp/common/v1",
    protos = [":common_proto"],
)

proto_library(
    name = "logs_proto",
    srcs = [
        "opentelemetry/proto/logs/v1/logs.proto",
    ],
    deps = [
        ":common_proto",
        ":resource_proto",
    ],
)

cc_proto_library(
    name = "logs_proto_cc",
    deps = [":logs_proto"],
)

py_proto_library(
    name = "logs_proto_py",
    deps = [":logs_proto"],
)

go_proto_library(
    name = "logs_proto_go",
    importpath = "go.opentelemetry.io/proto/otlp/logs/v1",
    protos = [":logs_proto"],
    deps = [
        ":common_proto_go",
        ":resource_proto_go",
    ],
)

proto_library(
    name = "logs_service_proto",
    srcs = [
        "opentelemetry/proto/collector/logs/v1/logs_service.proto",
    ],
    deps = [
        ":logs_proto",
    ],
)

cc_proto_library(
    name = "logs_service_proto_cc",
    deps = [":logs_service_proto"],
)

cc_grpc_library(
    name = "logs_service_grpc_cc",
    srcs = [":logs_service_proto"],
    generate_mocks = True,
    grpc_only = True,
    deps = [":logs_service_proto_cc"],
)

py_proto_library(
    name = "logs_service_proto_py",
    deps = [":logs_service_proto"],
)

py_grpc_library(
    name = "logs_service_grpc_py",
    srcs = [":logs_service_proto"],
    deps = [":logs_service_proto_py"],
)

go_grpc_library(
    name = "logs_service_grpc_go",
    embed = [
        ":logs_proto_go",
    ],
    importpath = "go.opentelemetry.io/proto/otlp/logs/v1",
    protos = [":logs_service_proto"],
)

proto_library(
    name = "metrics_proto",
    srcs = [
        "opentelemetry/proto/metrics/v1/metrics.proto",
    ],
    deps = [
        ":common_proto",
        ":resource_proto",
    ],
)

cc_proto_library(
    name = "metrics_proto_cc",
    deps = [":metrics_proto"],
)

py_proto_library(
    name = "metrics_proto_py",
    deps = [":metrics_proto"],
)

go_proto_library(
    name = "metrics_proto_go",
    importpath = "go.opentelemetry.io/proto/otlp/metrics/v1",
    protos = [":metrics_proto"],
    deps = [
        ":common_proto_go",
        ":resource_proto_go",
    ],
)

proto_library(
    name = "metrics_service_proto",
    srcs = [
        "opentelemetry/proto/collector/metrics/v1/metrics_service.proto",
    ],
    deps = [
        ":metrics_proto",
    ],
)

cc_proto_library(
    name = "metrics_service_proto_cc",
    deps = [":metrics_service_proto"],
)

cc_grpc_library(
    name = "metrics_service_grpc_cc",
    srcs = [":metrics_service_proto"],
    generate_mocks = True,
    grpc_only = True,
    deps = [":metrics_service_proto_cc"],
)

py_proto_library(
    name = "metrics_service_proto_py",
    deps = [":metrics_service_proto"],
)

py_grpc_library(
    name = "metrics_service_grpc_py",
    srcs = [":metrics_service_proto"],
    deps = [":metrics_service_proto_py"],
)

go_grpc_library(
    name = "metrics_service_grpc_go",
    embed = [
        ":metrics_proto_go",
    ],
    importpath = "go.opentelemetry.io/proto/otlp/metrics/v1",
    protos = [":metrics_service_proto"],
)

proto_library(
    name = "resource_proto",
    srcs = [
        "opentelemetry/proto/resource/v1/resource.proto",
    ],
    deps = [
        ":common_proto",
    ],
)

cc_proto_library(
    name = "resource_proto_cc",
    deps = [":resource_proto"],
)

py_proto_library(
    name = "resource_proto_py",
    deps = [":resource_proto"],
)

go_proto_library(
    name = "resource_proto_go",
    importpath = "go.opentelemetry.io/proto/otlp/resource/v1",
    protos = [":resource_proto"],
    deps = [
        ":common_proto_go",
    ],
)

proto_library(
    name = "trace_proto",
    srcs = [
        "opentelemetry/proto/trace/v1/trace.proto",
    ],
    deps = [
        ":common_proto",
        ":resource_proto",
    ],
)

cc_proto_library(
    name = "trace_proto_cc",
    deps = [":trace_proto"],
)

py_proto_library(
    name = "trace_proto_py",
    deps = [":trace_proto"],
)

go_proto_library(
    name = "trace_proto_go",
    importpath = "go.opentelemetry.io/proto/otlp/trace/v1",
    protos = [":trace_proto"],
    deps = [
        ":common_proto_go",
        ":resource_proto_go",
    ],
)

proto_library(
    name = "trace_service_proto",
    srcs = [
        "opentelemetry/proto/collector/trace/v1/trace_service.proto",
    ],
    deps = [
        ":trace_proto",
    ],
)

cc_proto_library(
    name = "trace_service_proto_cc",
    deps = [":trace_service_proto"],
)

cc_grpc_library(
    name = "trace_service_grpc_cc",
    srcs = [":trace_service_proto"],
    generate_mocks = True,
    grpc_only = True,
    deps = [":trace_service_proto_cc"],
)

py_proto_library(
    name = "trace_service_proto_py",
    deps = [":trace_service_proto"],
)

py_grpc_library(
    name = "trace_service_grpc_py",
    srcs = [":trace_service_proto"],
    deps = [":trace_service_proto_py"],
)

go_grpc_library(
    name = "trace_service_grpc_go",
    embed = [
        ":trace_proto_go",
    ],
    importpath = "go.opentelemetry.io/proto/otlp/trace/v1",
    protos = [":trace_service_proto"],
)
